Python Trouble with matrix pathfinding (DFS)